#pragma once

#include "Event.h"


namespace Origin
{
    class ORIGIN_API KeyEvent: public Event
    {
    public:
        inline int GetKeyCode() const { return _key; }
        EVENT_CLASS_CATEGORY(KeyboardEventCategory |InputEventCategory)

    protected:
        KeyEvent(int key): _key(key) {}
        int _key;
    };

    class ORIGIN_API KeyPressedEvent: public KeyEvent
    {
    public:
        KeyPressedEvent(int key, int repeatCount): KeyEvent(key), _repeatCount(repeatCount) { }
        EVENT_CLASS_TYPE(KeyPressed)

        virtual std::string ToString() const override {
            std::stringstream ss;
            ss << "KeyPressedEvent:" << _key << "(" << _repeatCount << " repeats)";
            return ss.str();
        }
    private:
        int _repeatCount;

    };
    
    class ORIGIN_API KeyReleasedEvent: public KeyEvent
    {
    public:
        KeyReleasedEvent(int key): KeyEvent(key) {}
        EVENT_CLASS_TYPE(KeyReleased)

        virtual std::string ToString() const override {
            std::stringstream ss;
            ss << "KeyReleasedEvent:" << _key;
            return ss.str();
        }
    };

    class ORIGIN_API KeyTypedEvent : public KeyEvent
    {
    public:
        KeyTypedEvent(int key): KeyEvent(key) {}
        EVENT_CLASS_TYPE(KeyTyped)

        virtual std::string ToString() const override {
            std::stringstream ss;
            ss << "KeyTypedEvent: " << _key;
            return ss.str();
        }
    };
}